$(document).ready(function(){
    var scheduleId=0;
    try {
        scheduleId = localStorage.getItem("scheduleId");
    } catch (error) {
        scheduleId=0;
    }
    if(scheduleId>0){
        $.ajax({
            type: "POST",
            url: "./GetScheduleDetail",
            data: "scheduleId="+scheduleId,
            success: function(json){
              var json =JSON.parse(json);
              if(json.flag=="success"){
            	  var schedule=json.infoList[0].listSchedule[0];
            	  var info=schedule.DepartureAirportIATA+" to "+
            	  schedule.ArrivalAirportIATA +","+
            	  schedule.Time+","+
            	  schedule.Name;
                  $(".info").text(info);
                  var imgSrc="./image/Aircraft-"+schedule.Name+".jpg";
                  $(".TSDimg img").attr("src",imgSrc);
                  var listSeatLayout=json.infoList[0].listSeatLayout;
                  for(var i=0;i<schedule.FirstSeatsAmount;i++){
                        var seatdata=listSeatLayout[i];
                        var seat="<div class='seatstyle' data-name='3L'>"+seatdata.RowNumber+seatdata.ColumnName+"</div>";
                        $(".firstclass").append(seat);
                  } 
                  var listTickets = json.infoList[0].listTickets;
                  
                  $(".FirstClass .p2").text(0+"/"+schedule.FirstSeatsAmount+" "+0.00);
              }
            }
        });
    }
});
